//���ݿ������࣬������public static Connection getConnction()
//ע�⣺������ݿ������û��������� ����ȷ
package Dbcon;
import com.common.Constant;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class DBcon {

	private static final String DRIVER_CLASS = "com.mysql.jdbc.Driver";

	private static final String DATABASE_URL =Constant.mysqlUrl;

	private static final String DATABASE_USRE = Constant.mysqlUser;

	private static final String DATABASE_PASSWORD = Constant.mysqlPW;

	public static Connection getConnction(){
		Connection dbConnection = null;
		try {
			Class.forName(DRIVER_CLASS);
			dbConnection = DriverManager.getConnection(DATABASE_URL,
					DATABASE_USRE, DATABASE_PASSWORD);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return dbConnection;
	}
	
public static void close(ResultSet rs,Statement st,Connection conn){
		
		try {
			if(rs != null){
				rs.close();
			}
			if(st != null){
				st.close();
			}
			if(conn != null){
				conn.close();
			}
			
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
